| Server IP : 121.121.20.254 / Your IP : 216.73.216.133 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/LibreOffice/help/en-US/text/sbasic/shared/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Variables</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<a name="variables"></a>
<h1 id="hd_id3149669" dir="auto">Variables</h1>
<p id="par_id3147265" class="paragraph" dir="auto">The following statements and functions are for working with variables. You can use these functions to declare or define variables, convert variables from one type to another, or determine the variable type.</p>
<div class="embedded">
<a name="ccur"></a>
<h2 id="par_idN10541" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100050.html">CCur Function</a></h2>
<p id="par_idN10545" class="paragraph" dir="auto">Converts a string expression or numeric expression to a currency expression. The locale settings are used for decimal separators and currency symbols.</p>
</div>
<div class="embedded">
<a name="cbool"></a>
<h2 id="hd_id3150616" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100100.html">CBool Function</a></h2>
<p id="par_id3145136" class="paragraph" dir="auto">Converts an expression or a set of expressions into a boolean. An expression is composed of strings, numbers and operators. Comparison, logical or mathematical operators are allowed inside expressions.</p>
</div>
<div class="embedded">
<a name="cdate"></a>
<h2 id="hd_id3150772" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100300.html">CDate Function</a></h2>
<p id="par_id3150986" class="paragraph" dir="auto">Converts any string or numeric expression to a date value.</p>
</div>
<div class="embedded">
<a name="cdec"></a>
<h2 id="par_idN10548" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100060.html">CDec Function</a></h2>
<p id="par_idN10558" class="paragraph" dir="auto">Converts a string expression or numeric expression to a decimal expression.</p>
</div>
<div class="embedded">
<a name="cdbl"></a>
<h2 id="hd_id3153750" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100400.html">CDbl Function</a></h2>
<p id="par_id3149233" class="paragraph" dir="auto">Converts any numerical expression or string expression to a double type.</p>
</div>
<div class="embedded">
<a name="cint"></a>
<h2 id="hd_id3149346" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100500.html">CInt Function</a></h2>
<p id="par_id3155419" class="paragraph" dir="auto">Converts any string or numeric expression to an integer.</p>
</div>
<div class="embedded">
<a name="clng"></a>
<h2 id="hd_id3153311" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100600.html">CLng Function</a></h2>
<p id="par_id3148686" class="paragraph" dir="auto">Converts any string or numeric expression to a long integer.</p>
</div>
<div class="embedded">
<a name="const"></a>
<h2 id="hd_id3146958" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100700.html">Const Statement</a></h2>
<p id="par_id3154143" class="paragraph" dir="auto">Defines one or more identifiers as constants.</p>
</div>
<div class="embedded">
<a name="csng"></a>
<h2 id="hd_id3153753" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100900.html">CSng Function</a></h2>
<p id="par_id3149748" class="paragraph" dir="auto">Converts any string or numeric expression to data type Single.</p>
</div>
<div class="embedded">
<a name="cstr"></a>
<h2 id="hd_id3146958" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101000.html">CStr Function</a></h2>
<p id="par_id3147574" class="paragraph" dir="auto">Converts any numeric expression to a string expression.</p>
</div>
<div class="embedded">
<a name="cvar"></a>
<h2 id="par_idN1054B" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100070.html">CVar Function</a></h2>
<p id="par_idN1055B" class="paragraph" dir="auto">Converts a string expression or numeric expression to a variant expression.</p>
</div>
<div class="embedded">
<a name="cverr"></a>
<h2 id="par_idN1054B" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03100080.html">CVErr Function</a></h2>
<p id="par_idN1055B" class="paragraph" dir="auto">Converts a string expression or numeric expression to a variant expression of the sub type "Error".</p>
</div>
<div class="embedded">
<a name="defbool"></a>
<h2 id="hd_id3145759" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101100.html">DefBool Statement</a></h2>
<p id="par_id3153089" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefBool statement sets the default data type for variables, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defcur"></a>
<h2 id="par_idN1057D" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101110.html">DefCur Statement</a></h2>
<p id="par_idN1058D" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefCur statement sets the default variable type, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defdate"></a>
<h2 id="hd_id3150504" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101300.html">DefDate Statement</a></h2>
<p id="par_id3145069" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefDate statement sets the default variable type, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defdbl"></a>
<h2 id="hd_id3147242" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101400.html">DefDbl Statement</a></h2>
<p id="par_id3153126" class="paragraph" dir="auto">Sets the default variable type, according to a letter range, if no type-declaration character or keyword is specified.</p>
</div>
<div class="embedded">
<a name="deferr"></a>
<h2 id="par_idN1057D" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101120.html">DefErr Statement</a></h2>
<p id="par_idN1058D" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefErr statement sets the default variable type, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defint"></a>
<h2 id="hd_id3149811" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101500.html">DefInt Statement</a></h2>
<p id="par_id3149762" class="paragraph" dir="auto">Sets the default variable type, according to a letter range, if no type-declaration character or keyword is specified.</p>
</div>
<div class="embedded">
<a name="deflng"></a>
<h2 id="hd_id3148538" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101600.html">DefLng Statement</a></h2>
<p id="par_id3149514" class="paragraph" dir="auto">Sets the default variable type, according to a letter range, if no type-declaration character or keyword is specified.</p>
</div>
<div class="embedded">
<a name="defobj"></a>
<h2 id="hd_id3149811" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101700.html">DefObj Statement</a></h2>
<p id="par_id3147573" class="paragraph" dir="auto">Sets the default variable type, according to a letter range, if no type-declaration character or keyword is specified.</p>
</div>
<div class="embedded">
<a name="defsng"></a>
<h2 id="par_idN10577" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101130.html">DefSng Statement</a></h2>
<p id="par_idN10587" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefSng statement sets the default variable type, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defstr"></a>
<h2 id="par_idN10577" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03101140.html">DefStr Statement</a></h2>
<p id="par_idN10587" class="paragraph" dir="auto">If no type-declaration character or keyword is specified, the DefStr statement sets the default variable type, according to a letter range.</p>
</div>
<div class="embedded">
<a name="defvar"></a>
<h2 id="hd_id3143267" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102000.html">DefVar Statement</a></h2>
<p id="par_id3153825" class="paragraph" dir="auto">Sets the default variable type, according to a letter range, if no type-declaration character or keyword is specified.</p>
</div>
<div class="embedded">
<a name="dimtext"></a>
<h2 id="hd_id3149812" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102100.html">Dim Statement</a></h2>
<p id="par_id3143271" class="paragraph" dir="auto">Declares variables or arrays.</p>
</div>
<div class="embedded">
<a name="redim"></a>
<h2 id="hd_id3150398" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102101.html">ReDim Statement</a></h2>
<p id="par_id3154685" class="paragraph" dir="auto">Declares or redefines variables or arrays.</p>
</div>
<div class="embedded">
<a name="type"></a>
<h2 id="hd_id3153311" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03090413.html">Type Statement</a></h2>
<p id="par_id3159158" class="paragraph" dir="auto">Define non-UNO data structures.</p>
</div>
<div class="embedded">
<a name="isarray"></a>
<h2 id="hd_id3154346" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102200.html">IsArray Function</a></h2>
<p id="par_id3159413" class="paragraph" dir="auto">Determines if a variable is a data field in an array.</p>
</div>
<div class="embedded">
<a name="isdate"></a>
<h2 id="hd_id3145090" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102300.html">IsDate Function</a></h2>
<p id="par_id3153311" class="paragraph" dir="auto">Tests if a numeric or string expression can be converted to a <span class="emph">Date</span> variable.</p>
</div>
<div class="embedded">
<a name="isempty"></a>
<h2 id="hd_id3153394" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102400.html">IsEmpty Function</a></h2>
<p id="par_id3163045" class="paragraph" dir="auto">Tests if a Variant variable contains the Empty value. The Empty value indicates that the variable is not initialized.</p>
</div>
<div class="embedded">
<a name="iserror"></a>
<h2 id="par_idN1054E" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102450.html">IsError Function</a></h2>
<p id="par_idN1055E" class="paragraph" dir="auto">Tests if a variable contains an error value.</p>
</div>
<div class="embedded">
<a name="isnull"></a>
<h2 id="hd_id3155555" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102600.html">IsNull Function</a></h2>
<p id="par_id3146957" class="paragraph" dir="auto">Tests if a Variant contains the special Null value, indicating that the variable does not contain data.</p>
</div>
<div class="embedded">
<a name="isnumeric"></a>
<h2 id="hd_id3145136" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102700.html">IsNumeric Function</a></h2>
<p id="par_id3149177" class="paragraph" dir="auto">Tests if an expression is a number. If the expression is a <a target="_top" href="en-US/text/sbasic/shared/00000002.html#dezimal">number</a>, the function returns True, otherwise the function returns False.</p>
</div>
<div class="embedded">
<a name="isobject"></a>
<h2 id="hd_id51633474369322" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102800.html">IsObject Function</a></h2>
<p id="par_id3148538" class="paragraph" dir="auto">Tests if a variable is an object, as opposed to primitive data types such as dates, numbers, texts. The function returns <span class="literal">True</span> if the variable is an object, otherwise it returns <span class="literal">False</span>.</p>
</div>
<div class="embedded">
<a name="lbound"></a>
<h2 id="hd_id3156027" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03102900.html">LBound Function</a></h2>
<p id="par_id3147226" class="paragraph" dir="auto">Returns the lower boundary of an array.</p>
</div>
<div class="embedded">
<a name="ubound"></a>
<h2 id="hd_id3148538" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103000.html">UBound Function</a></h2>
<p id="par_id3147573" class="paragraph" dir="auto">Returns the upper boundary of an array.</p>
</div>
<div class="embedded">
<a name="let"></a>
<h2 id="hd_id3147242" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103100.html">Let Statement</a></h2>
<p id="par_id3149233" class="paragraph" dir="auto">Assigns a value to a variable.</p>
</div>
<div class="embedded">
<a name="array"></a>
<h2 id="hd_id3150499" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104200.html">Array Function</a></h2>
<p id="par_id3155555" class="paragraph" dir="auto">Returns the type Variant with a data field.</p>
</div>
<div class="embedded">
<a name="dimarray"></a>
<h2 id="hd_id3150616" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104300.html">DimArray Function</a></h2>
<p id="par_id3153527" class="paragraph" dir="auto">Returns a Variant array.</p>
</div>
<div class="embedded">
<a name="erase"></a>
<h2 id="par_idN10548" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104700.html">Erase Statement</a></h2>
<p id="par_idN10558" class="paragraph" dir="auto">Erases the contents of array elements of fixed size arrays, and releases the memory used by arrays of variable size.</p>
</div>
<div class="embedded">
<a name="optionbase"></a>
<h2 id="hd_id3155805" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103200.html">Option Base Statement</a></h2>
<p id="par_id3147242" class="paragraph" dir="auto">Defines the default lower boundary for arrays as 0 or 1.</p>
</div>
<div class="embedded">
<a name="optionexplicit"></a>
<h2 id="hd_id3145090" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103300.html">Option Explicit Statement</a></h2>
<p id="par_id3148538" class="paragraph" dir="auto">Specifies that every variable in the program code must be explicitly declared with the Dim statement.</p>
</div>
<div class="embedded">
<a name="public"></a>
<h2 id="hd_id3153311" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103400.html">Public Statement</a></h2>
<p id="par_id3150669" class="paragraph" dir="auto">Dimensions a variable or an array at the module level (that is, not within a subroutine or function), so that the variable and the array are valid in all libraries and modules.</p>
</div>
<div class="embedded">
<a name="global"></a>
<h2 id="hd_id3159201" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103450.html">Global keyword</a></h2>
<p id="par_id3149177" class="paragraph" dir="auto">Dimensions a variable or an array at the global level (that is, not within a subroutine or function), so that the variable and the array are valid in all libraries and modules for the current session.</p>
</div>
<div class="embedded">
<a name="static"></a>
<h2 id="hd_id3149798" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103500.html">Static Statement</a></h2>
<p id="par_id3153311" class="paragraph" dir="auto">Declares a variable or an array at the procedure level within a subroutine or a function, so that the values of the variable or the array are retained after exiting the subroutine or function. Dim statement conventions are also valid.</p>
</div>
<div class="embedded">
<a name="typename"></a>
<h2 id="hd_id3143267" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103600.html">TypeName Function; VarType Function</a></h2>
<p id="par_id3159157" class="paragraph" dir="auto">Returns text or a numeric value that contain type information for a variable.</p>
</div>
<div class="embedded">
<a name="set"></a>
<h2 id="hd_id3154422" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103700.html">Set Statement</a></h2>
<p id="par_id3159149" class="paragraph" dir="auto">Sets an object reference on a variable.</p>
</div>
<div class="embedded">
<a name="findobject"></a>
<h2 id="hd_id3145136" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103800.html">FindObject Function</a></h2>
<p id="par_id3155341" class="paragraph" dir="auto">Enables an object to be addressed at run-time as a string parameter through the object name.</p>
</div>
<div class="embedded">
<a name="findpropertyobject"></a>
<h2 id="hd_id3146958" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103900.html">FindPropertyObject Function</a></h2>
<p id="par_id3154285" class="paragraph" dir="auto">Enables objects to be addressed at run-time as a string parameter using the object name.</p>
</div>
<div class="embedded">
<a name="optional"></a>
<h2 id="hd_id3149205" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104100.html">Optional (in Function Statement)</a></h2>
<p id="par_id3143267" class="paragraph" dir="auto">Allows you to define parameters that are passed to a function as optional.</p>
</div>
<div class="embedded">
<a name="ismissing"></a>
<h2 id="hd_id3153527" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104000.html">IsMissing Function</a></h2>
<p id="par_id3153825" class="paragraph" dir="auto">Tests if a function is called with an optional parameter.</p>
</div>
<div class="embedded">
<a name="hasunointerfaces"></a>
<h2 id="hd_id3149987" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104400.html">HasUnoInterfaces Function</a></h2>
<p id="par_id3151262" class="paragraph" dir="auto">Tests if a Basic Uno object supports certain Uno interfaces.</p>
</div>
<div class="embedded">
<a name="equalunoobjects"></a>
<h2 id="hd_id791633472607429" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104600.html">EqualUnoObjects Function</a></h2>
<p id="par_id3145090" class="paragraph" dir="auto">Returns <span class="emph">True</span> if the two specified Basic variables represent the same Uno object instance.</p>
</div>
<div class="embedded">
<a name="isunostruct"></a>
<h2 id="hd_id3146117" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03104500.html">IsUnoStruct Function</a></h2>
<p id="par_id3146957" class="paragraph" dir="auto">Returns True if the given object is a Uno struct.</p>
</div>
</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03100000.xhp" target="_blank">/text/sbasic/shared/03100000.xhp</a></p>
<p dir="auto">Title is: Variables</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>